<template>
  <div class="stars">
    <div class="star_title">
        <!-- 星星的图片列表 -->
        <div class="star_img_list">
            <img v-show="point<1" src="@/static/user/set/star.png" alt="" @click="pointChange(1)">
            <img v-show="point>=1" src="@/static/user/set/star-active.png" alt="" @click="pointChange(1)">
            <img v-show="point<2" src="@/static/user/set/star.png" alt="" @click="pointChange(2)">
            <img v-show="point>=2" src="@/static/user/set/star-active.png" alt="" @click="pointChange(2)">
            <img v-show="point<3" src="@/static/user/set/star.png" alt="" @click="pointChange(3)">
            <img v-show="point>=3" src="@/static/user/set/star-active.png" alt="" @click="pointChange(3)">
            <img v-show="point<4" src="@/static/user/set/star.png" alt="" @click="pointChange(4)">
            <img v-show="point>=4" src="@/static/user/set/star-active.png" alt="" @click="pointChange(4)">
            <img v-show="point<5" src="@/static/user/set/star.png" alt="" @click="pointChange(5)">
            <img v-show="point>=5" src="@/static/user/set/star-active.png" alt="" @click="pointChange(5)">
        </div>
        <!-- 具体的分数列表 -->
        <div class="star_point">
            {{ point.toFixed(1) }}分
        </div>
    </div>
    <!-- 评分的描述 -->
    <div class="star_detail">
        {{ 
            point == 0 ? '动动您的小手打个分吧~' : 
            point == 1 ? '体验极差' :
            point == 2 ? '感觉一般' : 
            point == 3 ? '需要改进' :
            point == 4 ? '稳中求进,继续加油' : '完美无瑕'    
        }}
    </div>
  </div>
</template>

<script>
export default {
    props: {
        // 评分
        point:{
            type: [String,Number],
            default: () => {
                return 0
            }
        }
    },
    methods: {
        pointChange(index){
            // 通知父组件 
            this.$emit('changePoint',index)
            // this.point = index;
        }
    }
}
</script>

<style lang="scss" scoped>
    .star_title{
        width: 100%;
        height: 44px;
        line-height: 44px;
        display: flex;
        .star_img_list{
            width: 58%;
            display: flex;
            justify-content: space-between;
            align-items: center;
            img{
                height: 35px;
            }
        }
        .star_point{
            width: 20%;
            text-align: center;
            line-height: 44px;
        }
    }
    .star_detail{
        padding-top: 20px;
    }
</style>